package com.team.cluedo;



import android.app.ListActivity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.team.client_server.Client;
import com.team.cluedo.app.CreateGame;
import com.team.cluedo.app.JoinGame;
import com.team.cluedo.app.SendOneCard;

import com.team.cluedo.fc.Cluedo;
import com.team.communication.CallClientMethods;



public class Game extends ListActivity {
    
	static final String[] MENU = new String[] {"Creer partie", "Rejoindre partie","Quitter"};
	Bundle savedInstanceState;
	
	
	static Client client = new Client();
	
	static CallClientMethods cm = client.getCm();
	static public Cluedo cluedo = new Cluedo();
	
	

	@Override
	public void onCreate(Bundle savedInstanceState) {
	  super.onCreate(savedInstanceState);
	  setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
	  this.savedInstanceState = savedInstanceState;
	  cluedo.activity = this;
	  setListAdapter(new ArrayAdapter<String>(this,
	          android.R.layout.simple_list_item_1, MENU));
	  getListView().setTextFilterEnabled(true);
	  
	}
	
	@Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
        //String s = (String) l.getItemAtPosition(position);
		Intent defineIntent;
		
        switch(position){
        case 0:
        	defineIntent = new Intent(this,CreateGame.class);
     		this.startActivity(defineIntent);
     		this.finish();
        	break;
        case 1:
        	defineIntent = new Intent(this,JoinGame.class);
     		this.startActivity(defineIntent);
     		this.finish();
        	break;
        case 2:
        	
        	defineIntent = new Intent(this,SendOneCard.class);
     		this.startActivity(defineIntent);
        	this.finish();
        	break;
        default: break;
        }
    }
	
	
	
}